﻿<UserControl x:Class="PocketBook.Views.Designs.WeekPageView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="380" d:DesignWidth="280">
    <UserControl.Resources>
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="FontFamily" Value="Georgia" />
        </Style>

        <DataTemplate x:Key="DayTemplate">
            <Border BorderThickness="0.5,0,0.5,1" BorderBrush="Gainsboro" SnapsToDevicePixels="true">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <DockPanel Background="Gainsboro">
                        <Rectangle DockPanel.Dock="Right" Margin="3" Stroke="Gray" Fill="White" Width="10" Height="10" />
                        <TextBlock Padding="2,0,2,0" FontFamily="Georgia">
                        <Run Text="{Binding Day, Mode=OneWay}" FontSize="9pt" /> <Run FontSize="7pt" Text="{Binding Date, StringFormat=dddd, Mode=OneWay}" />
                        </TextBlock>
                    </DockPanel>
                </Grid>
            </Border>
        </DataTemplate>
        
        <Style TargetType="{x:Type ItemsControl}">
            <Setter Property="ItemTemplate" Value="{StaticResource DayTemplate}"/>
        </Style>
               
        
    </UserControl.Resources>
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="5*" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Border BorderThickness="0,0,0,1" BorderBrush="Black" Padding="2">
            <TextBlock FontFamily="Georgia" HorizontalAlignment="Right" Text="{Binding StartOfWeek, StringFormat=MMMM yyyy}" Padding="2" />
        </Border>
        <ItemsControl Grid.Row="1" ItemsSource="{Binding DaysOfWeek}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid Rows="5" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
        <ItemsControl Grid.Row="2" ItemsSource="{Binding DaysOfWeekend}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid Columns="2" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
    </Grid>
</UserControl>
